<template>
  <div class="top-header">
    <div class="top-header-left">
      <div class="dynamic">
        <img class="rotating-image" src="../../assets/image/home/Frame%202036083419.png" alt="">
        <img class="Frame-2036083419" src="../../assets/image/home/Frame 2036083419-1.png" alt="">
      </div>
      <div class="dynamic-right">
        <div class="dynamic-right-top">
          <div class="dynamic-right-top-left">
            <div></div>
            <p>正在评标中...</p>
          </div>
          <span class="dynamic-right-top-num">3/5</span>
        </div>
        <el-progress :percentage="60" status="success" :show-text="false"/>
      </div>
    </div>
    <div class="top-header-center">
      <p class="date">{{ date }}</p>
      <p class="time">{{ moreTime }}</p>
    </div>
    <div class="top-header-right">
      <div class="dynamic">
        <img class="rotating-image" src="../../assets/image/home/Group%201912056047.png" alt="">
        <img class="Frame-2036083419" src="../../assets/image/home/signature-icon.png" alt="">
      </div>
      <div class="dynamic-right">
        <div class="dynamic-right-top">
          <div class="dynamic-right-top-left">
            <div></div>
            <p>完成签字</p>
          </div>
          <span class="dynamic-right-top-num">1/5</span>
        </div>
        <el-progress :percentage="20" :show-text="false"/>
      </div>
    </div>
  </div>
  <div class="top-right">
    <el-tooltip
        class="box-item"
        effect="dark"
        content="切换标段"
        placement="bottom"
    >
      <img src="../../assets/image/home/Component%2038.png" alt="">
    </el-tooltip>
    <el-tooltip
        class="box-item"
        effect="dark"
        content="切换场景"
        placement="bottom"
    >
      <img src="../../assets/image/home/Component%2039.png" alt="">
    </el-tooltip>
    <img src="../../assets/image/home/Component%2037.png" alt="">
    <div class="box-item">
      <el-button @click="deleteZJ">删除</el-button>
    </div>
  </div>
  <div class="features">
    <div class="features-top">
      功能
    </div>
    <div class="features-item" v-for="(item,index) in featuresList" :key="index">
      <img :src=item.url alt="">
      <p>{{ item.name }}</p>
    </div>
  </div>
  <div class="chat">
    <div class="chat-content">
      <img class="chat-img" src="@/assets/image/home/Component 40.png" alt="">
      <div>
        <p v-for="(item,index) in chatList" :key="index">
          <span>{{ item.name }}</span>
          <span>{{ item.content }}</span>
        </p>
      </div>
      <el-input placeholder="请输入内容">
        <template v-slot:prefix>
          <img src="@/assets/image/home/Component 24-5.png" alt="" style="width: 24px">
        </template>
      </el-input>
    </div>
  </div>
</template>
<script setup>
import {ref, onMounted, onBeforeUnmount} from 'vue';
import { useMeshEditStore } from "@/store/meshEditStore";
const store = useMeshEditStore();
const timer = ref()
const date = ref("")//年月日
const moreTime = ref("")//时分秒
const featuresList = ref([
  {url: new URL('@/assets/image/home/Component 24-4.png', import.meta.url).href, name: '视频'},
  {url: new URL('@/assets/image/home/Component 24-5.png', import.meta.url).href, name: '声音'},
  {url: new URL('@/assets/image/home/Component 24-3.png', import.meta.url).href, name: '演示'},
  {url: new URL('@/assets/image/home/Component 24-6.png', import.meta.url).href, name: '举手'},
  {url: new URL('@/assets/image/home/Component 24.png', import.meta.url).href, name: '会议'},
  {url: new URL('@/assets/image/home/Component 24-2.png', import.meta.url).href, name: '询标'},
])
const chatList = ref([
  {name: '钱亮：', content: '10万吨级的“海上粮仓”，到底有多厉害？'},
  {name: '周晟：', content: '中国正能量，为奋进的中国吹响号角'},
  {name: '郑文鉴：', content: '10万吨级的“海上粮仓”，到底有多厉害？'},
  {name: '钱品妍：', content: '无人机全程拍摄！时隔三十多年再探切尔诺贝利核电站 如今变成什么样'},
  {name: '赵家宝：', content: '福建文化遗产，你知道多少？'},
])
onMounted(() => {
  //创建定时器1秒执行一次
  timer.value = setInterval(() => {
    formateDate()
  }, 1000)
})
//取消定时器
onBeforeUnmount(() => {
  clearInterval(timer.value) //清除定时器
})
//获取当前时间
const formateDate = () => {
  const time = new Date()
  const year = time.getFullYear()
  const month = complement(time.getMonth() + 1)
  const day = complement(time.getDate())
  const hour = complement(time.getHours())
  const minute = complement(time.getMinutes())
  const second = complement(time.getSeconds())
  moreTime.value = `${hour}:${minute}:${second}`
  date.value = `${year}.${month}.${day}`
}

const deleteZJ = () => {
  store.modelApi.deleteZJ();
  alert("删除成功")
}
//当时间为个位数的时候，在数字前加0
const complement = (value) => {
  return value < 10 ? `0${value}` : value.toString()
}
</script>
<style scoped lang="scss">
.top-header {
  width: 100%;
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  .top-header-left, .top-header-right {
    width: 10vw;
    min-width: 180px;
    height: 4vh;
    min-height: 32px;
    background-color: rgba(47, 55, 87, 0.3);
    padding: 0 10px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    .dynamic {
      width: 24px;
      height: 28px;
      position: relative;
      @keyframes rotate {
        from {
          transform: rotate(0deg);
        }
        to {
          transform: rotate(360deg);
        }
      }
      .rotating-image {
        animation: rotate 2s linear infinite;
      }
      .Frame-2036083419 {
        position: absolute;
        top: 4px;
        left: 0;
      }
    }
    .dynamic-right {
      width: 80%;
      margin-left: 10px;
      .dynamic-right-top {
        display: flex;
        font-size: 14px;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 4px;
        .dynamic-right-top-left {
          display: flex;
          align-items: center;
          div {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background-color: rgba(38, 223, 116, 1);
            margin-right: 10px;
          }
          p {
            color: rgba(255, 255, 255, 1);
            font-size: 12px;
          }
        }
        .dynamic-right-top-num {
          background: rgba(223, 224, 226, 1);
          padding: 0 4px;
          font-size: 14px;
          height: 16px;
          line-height: 16px;
          border-radius: 2px;
        }
      }
      :deep(.el-progress-bar__outer) {
        height: 4px !important;
        background-color: rgba(100, 102, 107, 1);
      }
    }
  }
  .top-header-center {
    width: 200px;
    height: 64px;
    background: url("../../assets/image/home/Component41.png") no-repeat;
    text-align: center;
    padding-top: 4px;
    .date {
      color: rgba(144, 169, 255, 1);
      font-size: 12px;
      font-weight: bold;
    }
    .time {
      color: #FFFFFF;
      font-size: 20px;
      font-weight: bold;
    }
  }
  .top-header-right {
    .Frame-2036083419 {
      left: 1px;
    }
  }
}
.top-right {
  position: absolute;
  top: 10px;
  right: 16px;
  img {
    cursor: pointer;
    width: 48px;
  }
}
.features {
  position: absolute;
  top: 10%;
  left: 36px;
  background: rgba(62, 66, 83, 0.5);
  color: rgba(213, 214, 217, 1);
  text-align: center;
  padding: 0 0 16px;
  border-radius: 4px;
  .features-top {
    background: rgba(52, 97, 255, 0.2);
    padding: 8px 0;
    width: 100%;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 4px;
    font-size: 14px;
  }
  .features-item {
    margin: 0 16px;
    font-size: 12px;
    cursor: pointer;
    img {
      width: 36px;
      vertical-align: top;
    }
  }
}
.chat {
  position: absolute;
  width: 358px;
  height: 32vh;
  max-height: 264px;
  background: linear-gradient(180deg, rgba(62, 66, 83, 0) 0%, rgba(62, 66, 83, 0.7128) 5.57%, rgba(62, 66, 83, 0.88) 100%);
  bottom: 20px;
  left: 36px;
  padding: 10px 20px;
  border-radius: 4px;
  .chat-content {
    width: 100%;
    height: 90%;
    position: relative;
    padding-top: 24px;
    .chat-img {
      width: 48px;
      position: absolute;
      top: -24px;
    }
    p {
      line-height: 30px;
      span:first-of-type {
        color: rgba(52, 97, 255, 1);
      }
      span:last-of-type {
        color: #FFFFFF;
      }
    }
    :deep(.el-input) {
      //width: 100%;
      height: 36px;
      position: absolute;
      bottom: 0;
      .el-input__wrapper {
        background: transparent;
        box-shadow: 0 0 0 1px var(--el-text-color-primary, var(--el-text-color-primary)) inset;
        ::-webkit-input-placeholder {
          -webkit-text-fill-color: rgba(100, 102, 107, 1);
        }
      }
    }
  }
}
</style>
